﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PedidosPaquetesTuristicos.Soa_WebServices;
using System.Data;

namespace PedidosPaquetesTuristicos.Account
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            RegisterHyperLink.NavigateUrl = "Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);
        }

        protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e)
        {
            Soa_WebServices.WebServiceRegistraCliente Registra = new WebServiceRegistraCliente();
            DataSet Respuesta = Registra.BuscaCliente(LoginUser.UserName, LoginUser.Password);

            if (Respuesta.Tables[0].Rows.Count > 0)
            {
                Response.Redirect("~/About.aspx");
            }
            else {
                e.Authenticated = false;
                 }
        }
    }
}
